<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>{$pagetitle}</title>
        <meta name="renderer" content="webkit" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <link rel="stylesheet" href="/static/admin/layuiadmin/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="/static/admin/css/admin_global.css" />
        <link rel="stylesheet" href="/static/admin/plugin/select2/css/select2.min.css" />
        <link rel="stylesheet" href="/static/admin/plugin/fancybox/jquery.fancybox-1.3.4.vot.css" />
        <link rel="stylesheet" href="/static/admin/plugin/jsmind-master/style/jsmind.css" />
        <style> table{ table-layout: fixed; } td,th { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } </style>
    </head>
    <body>
        <div class="layui-fluid padding-top-20">
            <div class="layui-card">
                <div class="layui-form-header">
                    <div class="header-left" id="header-left"><span class="layui-btn iframe " data-href="{:url('add',['chat_products__id'=> $v.chat_products__id])}" data-title="聊天产品-新增" data-msg="确认操作吗？" data-height="100%" data-width="100%">新增</span></div>
                    <div class="header-right">
                        <form action="{:url()}" method="get" class="layui-form-pane" id="header-right">
                            <div class="layui-inline">
                                <label class="layui-form-label">名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="chat_products__name" id="chat_products__name" autocomplete="false" class="layui-input" placeholder="请输入名称" value="{:input('chat_products__name')}" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button type="submit" class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search"> <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> </button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="component-form-element" action="{:url()}" method="post" onsubmit="return save_form(this);">
                        <table class="layui-table" lay-filter="table1">
                            <thead>
                                <tr id="table-header">
                                    <th style="width: 50px;">编号</th>
                                    <th>名称</th>
                                    <th>原价</th>
                                    <th>价格</th>
                                    <th>时长（天）</th>
                                    <th>描述</th>
                                    <th>是否推荐</th>
                                    <th>排序字段</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="table-body">
                                {foreach $data as $v} 
                                <tr>
                                    <td title="{$v.chat_products__id}">{$v.chat_products__id}</td>
                                    <td title="{$v.chat_products__name}">{$v.chat_products__name}</td>
                                    <td title="{$v.chat_products__original_price}">{$v.chat_products__original_price}</td>
                                    <td title="{$v.chat_products__price}">{$v.chat_products__price}</td>
                                    <td title="{$v.chat_products__days}">{$v.chat_products__days}</td>
                                    <td title="{$v.chat_products__describe}">{$v.chat_products__describe}</td>
                                    <td>
                                        <?php
$chat_products__is_recommend_map = [ 1 =>
                                            '是', 0 => '否',
];
?> {if $v.chat_products__is_recommend!==''} {$chat_products__is_recommend_map[$v.chat_products__is_recommend]} {else/} - {/if} 
                                        </td>
                                        <td title="{$v.chat_products__sort}">{$v.chat_products__sort}</td>
                                        <td>
<span class="layui-btn layui-btn-sm iframe " data-href="{:url('update',['chat_products__id'=> $v.chat_products__id])}" data-title="聊天产品-修改" data-msg="确认操作吗？" data-height="100%" data-width="100%">修改</span>
<span class="layui-btn layui-btn-sm layui-btn-danger ajax_del " data-href="{:url('delete',['chat_products__id'=> $v.chat_products__id])}" data-title="聊天产品-删除" data-msg="确认删除操作吗？？" data-height="100%" data-width="100%">删除</span>
</td>
                                    </tr>
                                    {/foreach} 
                                </tbody>
                            </table>
                            <div class="layui-inline" id="table-footer"></div>
                        </form>
                        <div class="layui-box layui-laypage layui-laypage-default" id="table-paginate">{$paginate|raw}</div>
                    </div>
                </div>
            </div>
            <script src="/static/admin/layuiadmin/layui/layui.js"></script>
            <script src="/static/js/jquery-3.6.2.min.js"></script>
            <script src="/static/admin/plugin/select2/js/select2.full.min.js"></script>
            <script src="/static/js/crypto-js.min.js"></script>
            <script src="/static/admin/js/global.js"></script>
            <script src="/static/admin/plugin/fancybox/jquery.easing-1.3.pack.js"></script>
            <script src="/static/admin/plugin/fancybox/jquery.fancybox-1.3.4.vot.js"></script>
            <script src="/static/admin/plugin/shengshiqu/distpicker.data.js"></script>
            <script src="/static/admin/plugin/shengshiqu/distpicker.js"></script>
            <script src="/static/admin/js/openfile.js"></script>
            <script src="/static//admin/js/check.js"></script>
            <script src="/static/admin/plugin/jsmind-master/js/jsmind.js"></script>
            <!--文件上传 start-->
            <script src="/static/admin/plugin/webuploader/kinderfile.js"></script>
            <script src="/static/admin/plugin/webuploader/Sortable.js"></script>
            <script src="/static/admin/plugin/webuploader/morepic.js"></script>
            <!--以下是针对 快速上传单个文件插件-->
            <link rel="stylesheet" href="/static/admin/plugin/webuploader/style/webuploader.css" />
            <link rel="stylesheet" href="/static/admin/plugin/webuploader/style/style.css" />
            <script src="/static/admin/plugin/webuploader/webuploader.min.js"></script>
            <script src="/static/admin/plugin/webuploader/fastupimg.js"></script>
            <script>
  function playVideoSrc(src) {
    if(src){
      $.fancybox({
        content:'<div class="fancybox_video_play"><video  style="width:100%;height:600px" id="fancybox_video_src" src="'+src+'" autoplay controls></video></div>',
      })
    }else{
      layer.msg("视频地址为空");
    }
  }
</script>
            <script>

  $(document).ready(function() {
    $("a.fancybox").fancybox();
    $('.select2').select2();
  })

  layui.laydate.render({
    elem: '.form-date'
  })

</script>
            <script id="js1"></script>
            <script>
  function exportTable(){
    // 使用outerHTML属性获取整个table元素的HTML代码（包括<table>标签），然后包装成一个完整的HTML文档，设置charset为urf-8以防止中文乱码
    var html = "<html><head><meta charset='utf-8' /></head><body>" + document.getElementsByTagName("table")[0].outerHTML + "</body></html>";
    // 实例化一个Blob对象，其构造函数的第一个参数是包含文件内容的数组，第二个参数是包含文件类型属性的对象
    var blob = new Blob([html], { type: "application/vnd.ms-excel" });
    var a = document.getElementById("download_a");
    // 利用URL.createObjectURL()方法为a元素生成blob URL
    a.href = URL.createObjectURL(blob);
    // 设置文件名
    a.download = "{$exportName}.xls";
    a.click()
  }
</script>
        </body>
    </html>